//
//  BBuyNowShopDetailBottomView.m
//  DistributorAB
//
//  Created by LZY on 2019/10/10.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "BBuyNowShopDetailBottomView.h"

@implementation BBuyNowShopDetailBottomView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupViewAction];
    }
    return self;
}
#pragma mark - 界面布局
- (void)setupViewAction{
    UIView *viewPhone = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width / 2, self.height)];
    viewPhone.backgroundColor = kColorWithHex(0xffffff);
    [self addSubview:viewPhone];
    
    UIView *viewBuy = [[UIView alloc] initWithFrame:CGRectMake(viewPhone.width, 0, viewPhone.width, viewPhone.height)];
    viewBuy.backgroundColor = kColorWithHex(0xffffff);
    [self addSubview:viewBuy];
    
    UIImageView *ivPhone = [[UIImageView alloc] initWithFrame:CGRectMake((viewPhone.width - 100) / 2 , 11, 22, 22)];
    ivPhone.image = imgname(@"phone_yellow_icon");
    [viewPhone addSubview:ivPhone];
    
    UILabel *lblPhone = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(ivPhone.frame) + 18, 11, 60, 22)];
    lblPhone.text = @"咨询电话";
    lblPhone.font = [UIFont systemFontOfSize:14];
    lblPhone.textColor = kColorWithHex(0x333333);
    lblPhone.textAlignment = NSTextAlignmentRight;
    [viewPhone addSubview:lblPhone];
    
    UILabel *lblBuy = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, viewPhone.width, 43)];
    lblBuy.text = @"加入预订";
    lblBuy.font = [UIFont systemFontOfSize:16];
    lblBuy.textColor = kColorWithHex(0xffffff);
    lblBuy.textAlignment = NSTextAlignmentCenter;
    lblBuy.backgroundColor = kColorWithHex(0x70be68);
    [viewBuy addSubview:lblBuy];
    
    UIButton *btnPhone = [UIButton buttonWithType:UIButtonTypeCustom];
    btnPhone.frame = CGRectMake(0, 0, viewPhone.width, 43);
    btnPhone.tag = 200;
    [btnPhone addTarget:self action:@selector(btnBottomClickAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btnPhone];
    
    UIButton *btnBuy = [UIButton buttonWithType:UIButtonTypeCustom];
    btnBuy.frame = CGRectMake(viewPhone.width, 0, viewPhone.width, 43);
    btnBuy.tag = 201;
    [btnBuy addTarget:self action:@selector(btnBottomClickAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btnBuy];
    
}
#pragma mark - 交互事件
- (void)btnBottomClickAction:(UIButton *)sender{
    NSInteger tag = sender.tag;
    if (self.delegate && [self.delegate respondsToSelector:@selector(detailBottomViewClick:)]) {
        [self.delegate detailBottomViewClick:tag];
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
